package com.kaussoft.lolblog.vo;

import java.io.Serializable;

/** 
 * 		@hibernate.class
 * 		 table="REPLY"
 */
public class Reply implements Serializable {
	
	// serialVersionUID
	private static final long serialVersionUID = 1L;
	
	// hashCode
	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private Integer replyid;
	
	// fields
	private String replycontent;
	private String replytitle;
	
	// many to one
	private Article belongTo;
	
	/** default constructor */
	public Reply() {
		
	}

	/** primary key constructor */
	public Reply(Integer replyid) {
		this.setReplyid(replyid);
	}
	
	/** required fields constructor */
	public Reply(Integer replyid, String replytitle, String replycontent) {
		this.setReplyid(replyid);
		this.setReplytitle(replytitle);
		this.setReplycontent(replycontent);
	}
	
	/**
	 * 		@hibernate.property
	 * 		 column="PEPLY_CONTENT"
	 */
	public String getReplycontent() {
		return replycontent;
	}

	public void setReplycontent(String replycontent) {
		this.replycontent = replycontent;
	}

	/**
	 * 		@hibernate.id
	 * 		 column="PEPLY_ID"
	 * 		 generator-class="native"
	 * 		 type="java.lang.Integer"
	 * 		 unsaved-value=null
	 * 		@hibernate.generator-param name="sequence" value="SQ_PEPLY_ID"
	 */
	public Integer getReplyid() {
		return replyid;
	}

	public void setReplyid(Integer replyid) {
		this.replyid = replyid;
		this.hashCode = Integer.MIN_VALUE;
	}

	/**
	 * 		@hibernate.property
	 * 		 column="PEPLY_TITLE"
	 */
	public String getReplytitle() {
		return replytitle;
	}

	public void setReplytitle(String replytitle) {
		this.replytitle = replytitle;
	}
	
	/**
	 *		@hibernate.many-to-one
	 *		 column="ARTICLE_ID"
	 *		 class="com.kaussoft.lolblog.vo.Article"
	 *		 not-null="true"
	 */
	public Article getBelongTo() {
		return belongTo;
	}

	public void setBelongTo(Article belongTo) {
		this.belongTo = belongTo;
	}

	public boolean equals(Object obj) {
		if (null == obj) 
			return false;
		if (!(obj instanceof Reply)) 
			return false;
		else {
			Reply aObj = (Reply) obj;
			if (null == this.getReplyid() || null == aObj.getReplyid()) 
				return false;
			else 
				return (this.getReplyid().equals(aObj.getReplyid()));
		}
	}
	
	public int hashCode() {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getReplyid()) 
				return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getReplyid().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}

	public String toString() {
		return super.toString();
	}
}
